Mode (fld), Mode (fld, condFld), Mode (fld, condFld, cond)
Basic and Crystal syntax.
Arguments
- fld is any valid database or formula field that can be evaluated by the function.
- condFld is a field used to group the values in fld by.
- cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns
Fractional Number
Action
Identifies the most frequently occurring value.
For example:
- You can calculate the mode of all the values in a field. For information on this kind of summary, see SummaryFunction (fld).
- You can calculate the mode of all the values in the field, within a group (for example, sales grouped by the state that they come from). For information on this kind of summary, see SummaryFunction (fld, condFld).
- You can calculate the mode of all the values within a group in which grouping is controlled by changes in a date or Boolean field (for example, sales grouped by the month in which they were made). For information on this kind of summary, see SummaryFunction (fld, condFld, cond).
Examples
The following examples are applicable to both Basic and Crystal syntax:
Mode({Customer.CUSTOMER NAME})
Returns the mode (the most frequently occurring value) for the Customer Name field.
Mode({Customer.CUSTOMER NAME}, {Customer.REGION})
Groups values in the Customer Name field by region, and then returns the mode for the Customer Name field, per region.
Mode({Customer.CUSTOMER NAME}, {Customer.REGION}, "monthly")
Groups values in the Customer Name field by region, then returns the mode of the Customer Name field for each region, per month.
Comments
Mode works like NthMost Frequent when N = 1.
Note: Using this function in a formula forces the formula to be evaluated at print time.
For more information on evaluation time considerations, see Evaluation Time functions.